using System.Collections;
using System.Collections.Generic;
using Datas;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class MedicineCar : MonoBehaviour,IPointerClickHandler
{
    
    public Text carTitle;
    public Text carDescription;
    public Image carImage;

    public int carid;
    public Image CarDesImg;
    public HerbalList mCarList;
    

    
    void Start()
    {
        carid = Random.Range(0, mCarList.MedicincCarLists.Count);
        carTitle.text = "" + mCarList.MedicincCarLists[carid].HerbalTitle;
        carDescription.text = "" + mCarList.MedicincCarLists[carid].HerbalDescription;
        carImage.sprite = mCarList.MedicincCarLists[carid].HerbalImage;
        CarDesImg.sprite = mCarList.MedicincCarLists[carid].HerbalDesImage;
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    
    
    /**卡片被点击*/
    public void OnPointerClick(PointerEventData eventData)
    {
        Debug.Log("草药卡被点击");
      
        //将草药的id添加到背包数据中
        PlayerData.AddCardId(carid);
        
       
        //发送消息
        SendMessageUpwards("GetmedicineCarMessage");
        
       
    }
}
